-- paintballa2: -- local owner = owner ---------------------- -- Services local TweenS = game:service("TweenService") ------------- -- UTILS -- local Utils = {} function Utils:Create(InstData, Props) local Obj = Instance.new(InstData[1], InstData[2]) for k, v in pairs (Props) do Obj[k] = v end; return Obj end function Utils:CNR(cf) -- CFrameNoRotate return CFrame.new(cf.x,cf.y,cf.z) end -- LEGACY FUNCTIONS WITH ADDED FEATURES function Utils:ezweld(p, a, b, cf, c1) local weld = Instance.new("Weld",p) weld.Part0 = a weld.Part1 = b weld.C0 = cf if c1 then weld.C1 = c1 end return weld end function Utils:NewSound(p, id, pit, vol, loop, autoplay) local Sound = Instance.new("Sound",p) Sound.Pitch = pit Sound.Volume = vol Sound.SoundId = "rbxassetid://" ..id Sound.Looped = loop if autoplay then Sound:Play() end return Sound end ----------- local team = BrickColor.Red() local char = owner.Character -- control local bru = NLS([[ local UIS = game:service("UserInputService") local root = owner.Character.HumanoidRootPart local hum = owner.Character.Humanoid local crouch = false local crem = script.RemoteEvent function crouchee() if crouch then crouch = false crem:FireServer(false) hum.WalkSpeed = 16 else crouch = true crem:FireServer(true) hum.WalkSpeed = 8 end end UIS.InputBegan:connect(function(i, t) if not t and i.KeyCode == Enum.KeyCode.C then crouchee() end end) ]], owner.PlayerGui) local hum = char.Humanoid local rj = char.HumanoidRootPart:FindFirstChild"RootJoint" if rj then local rh = char.Torso["Right Hip"] local lh = char.Torso["Left Hip"] local rjc = rj.C0 local rhc = rh.C0 local lhc = lh.C0 Instance.new("RemoteEvent", bru).OnServerEvent:connect(function(_, wat) if wat then --rj.C0 = rjc * CFrame.new(0, 0, -1) hum.HipHeight = -1 rh.C0 = rhc * CFrame.new(.5, 1, 0) lh.C0 = lhc * CFrame.new(-.5, 0, 0) * CFrame.Angles(0, 0, math.pi/3) else --rj.C0 = rjc hum.HipHeight = 0 rh.C0 = rhc lh.C0 = lhc end end) end local function makeGun(pew, mesh, grip, bc) -- gun local grp = grip local paint = Utils:Create({"Tool", owner.Backpack}, { Grip = grp, Name = "paintball gun", }); local handl = Utils:Create({"Part", paint}, { Name = "Handle", BrickColor = bc }); Utils:Create({"SpecialMesh", handl}, { MeshId = mesh.id, Scale = mesh.scale, }) -- shooting local a = Instance.new("RemoteEvent", NLS([[ local rem = script.RemoteEvent local tool = script.Parent local han = tool.Handle local mouse = owner:GetMouse() tool.Activated:connect(function() if tool.Enabled then tool.Enabled = false --rem:FireServer(CFrame.new(han.CFrame.p, mouse.Hit.p).lookVector) rem:FireServer(mouse.Hit.p) task.wait(tool.firerate.Value) tool.Enabled = true end end) ]], paint)) Utils:Create({"NumberValue", paint}, {Name = "firerate", Value = mesh.rate}) -- shoot local bom = Utils:NewSound(handl, mesh.sid, mesh.spit or 1, mesh.vol or 1) a.OnServerEvent:connect(function(_,v) pew(paint, handl, grp, bom, v) end) return paint end makeGun(function(paint, handl, grp, bom, v) bom:Play() paint.Grip = grp * CFrame.Angles(-.1, 0, 0) task.delay(.075, function() paint.Grip = grp end) local off = CFrame.new(0, -1, -2) v = CFrame.new((handl.CFrame*off).p, v).LookVector local wee = Utils:Create({"Part", script}, { BrickColor = BrickColor.Yellow(), Size = Vector3.new(.5, .5, .5), Material = "SmoothPlastic", CFrame = CFrame.new((handl.CFrame*off).p, (handl.CFrame*off).p+v), Velocity = v * 300, Friction = .9, Elasticity = 0, CanCollide = false }); local force = Utils:Create({"BodyForce", wee}, { force = Vector3.new(0, workspace.Gravity * wee:GetMass()) }); wee:SetNetworkOwner(owner); wee.Touched:connect(function(hit) if hit.Parent and hit.Parent ~= paint.Parent then local h = hit.Parent:FindFirstChildOfClass("Humanoid") if hit.CanCollide then for i = 1,2 do local v = Vector3.new(math.random(-1,1), math.random(0,1), math.random(-1,1)) local s = Utils:Create({"Part", script}, { Velocity = v * 15, Size = Vector3.new(1, .4, 1), BrickColor = h and team or hit.BrickColor, CFrame = CFrame.new(wee.Position + v, v), }); game.Debris:AddItem(s, 4) end wee:Destroy() end if h and h.Parent ~= paint.Parent then local dud = game.Players:GetPlayerFromCharacter(hit.Parent) if (dud and (dud.Neutral or dud.TeamColor.Name ~= owner.TeamColor.Name)) or not dud then h.Health -= 20; wee:Destroy() end end end end) end, {id = "rbxassetid://3824749", scale = Vector3.one * 1.5, rate = .1, sid = 10209859, spit = 2}, CFrame.new(), BrickColor.Black()).Name = "AK47" makeGun(function(paint, handl, grp, bom, v) bom:Play() paint.Grip = grp * CFrame.Angles(-.1, 0, 0) task.delay(.4, function() paint.Grip = grp end) local off = CFrame.new(0, .25, 2) v = CFrame.new((handl.CFrame*off).p, v).LookVector local wee = Utils:Create({"Part", script}, { BrickColor = BrickColor.Yellow(), Size = Vector3.one * .25, Material = "SmoothPlastic", CFrame = CFrame.new((handl.CFrame*off).p, (handl.CFrame*off).p+v), Velocity = v * 450, Friction = .9, Elasticity = 0, CanCollide = false }); local force = Utils:Create({"BodyForce", wee}, { force = Vector3.new(0, workspace.Gravity * wee:GetMass()) }); wee:SetNetworkOwner(owner); wee.Touched:connect(function(hit) if hit.Parent and hit.Parent ~= paint.Parent then local h = hit.Parent:FindFirstChildOfClass("Humanoid") if hit.CanCollide then for i = 1,(hit.Name == "Head" and 4 or 2) do local v = Vector3.new(math.random(-1,1), math.random(0,1), math.random(-1,1)) local s = Utils:Create({"Part", script}, { Velocity = v * 15, Size = Vector3.new(1, .4, 1), BrickColor = h and team or hit.BrickColor, CFrame = CFrame.new(wee.Position + v, v), }); game.Debris:AddItem(s, 7) end wee:Destroy() end if h and h.Parent ~= paint.Parent then local dud = game.Players:GetPlayerFromCharacter(hit.Parent) if (dud and (dud.Neutral or dud.TeamColor.Name ~= owner.TeamColor.Name)) or not dud then h.Health -= 20; game.Debris:AddItem(wee, .1) if hit.Name == "Head" then h.Health -= 60*4 end end end end end) end, {id = "rbxassetid://2761723", scale = Vector3.one * .5, rate = 1, sid = 1369158, spit = 2}, CFrame.new(0, -.3, 1.8), BrickColor.Black()).Name = "Sniper"